<template>
  <div class="list-warp"
       @click="listWarpClick">
    <div class="img-box">
      <img :src="img+'?param=300y300'"
           lazy='loaded'
           class="pic-img"
           alt="">
      <div class="desc-warp">
        <span class="desc">{{desc || "..."}}</span>
      </div>
      <div class="play-icon">
        <i class="el-icon-video-play"></i>
      </div>
    </div>
    <p class="name">{{title || "..."}}</p>
  </div>
</template>
<script>
export default {
  props: {
    data: Object,
    img: String,
    desc: String,
    title: String
  },
  data () {
    return {
    }
  },
  created () { },
  mounted () { },
  methods: {
    // 点击歌单 跳转到歌曲列表界面
    listWarpClick () {
      this.$router.push(`/playlist/${this.data.id}`)
    }
  }
}
</script>
 <style lang='less' scoped>
.list-warp {
  position: relative;
  width: calc(20% - 0.146413rem);
  margin-bottom: 0.073206rem;
  cursor: pointer;
  .img-box {
    position: relative;
    width: 100%;
    //撑起高度
    padding-top: 100%;
    margin-bottom: 0.036603rem;
    border-radius: 0.036603rem;
    overflow: hidden;
    &:hover .desc-warp {
      transform: translateY(0);
    }
    &:hover .play-icon {
      opacity: 1;
    }
    .pic-img {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 100%;
    }
    .desc-warp {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      padding: 0.043924rem;
      background-color: rgba(0, 0, 0, 0.4);
      transform: translateY(-100%);
      -webkit-transform: translateY(-100%);
      transition: all 0.3s;
      -webkit-transition: all 0.3s;
      .desc {
        font-size: 0.087848rem;
        color: #fff;
      }
    }
    .play-icon {
      position: absolute;
      right: 0.036603rem;
      bottom: 0.036603rem;
      width: 0.263543rem;
      height: 0.263543rem;
      font-size: 0.183016rem;
      line-height: 0.263543rem;
      text-align: center;
      background-color: rgba(225, 225, 225, 0.562);
      border-radius: 50%;
      opacity: 0;
      transition: all 0.3s;
      -webkit-transition: all 0.3s;
      i {
        color: red;
      }
    }
  }
  .name {
    font-size: 0.087848rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
</style>
